<?php
require_once 'phpmoko/lib/common.php';

require_once 'phpmoko/ui/Panel.php';

class HorizontalPanel extends Panel
{

	function __construct()
	{
		parent::__construct();
	}

	function toString()
	{
		$str = '<table cellpadding="0" cellspacing="' . $this->spacing . '"';

		$str .= ' id="' . $this->id . '"';

		if ($this->getHorizontalAlignment() != null)
			$str .= ' align="' . $this->getHorizontalAlignment() . '"';

		if ($this->getWidth() != null)
			$str .= ' width="' . $this->getWidth() . '"';

		$str .= '>';

		$str .= '<tr>';

		foreach ($this as $widget) {
			$str .= '<td';

			if ($widget->getHorizontalAlignment() != null)
				$str .= ' align="' . $widget->getHorizontalAlignment() . '"';

			if ($widget->getVerticalAlignment() != null)
				$str .= ' valign="' . $widget->getVerticalAlignment() . '"';

			if ($widget->getWidth() != null)
				$str .= ' width="' . $widget->getWidth() . '"';

			$str .= '>' . Widget::toStringSafe($widget) . '</td>';
		}

		$str .= '</tr>';
		$str .= '</table>';

		return $str;
	}
}
?>